<?php $this->pageTitle = Yii::app()->name . ' - ' . AdmincpModule::t("Profile");
?>

<div id="content-header">
    <?php
    $this->widget('bootstrap.widgets.TbBreadcrumbs', array(
        'links' => array('Users' => array('user/index'), 'Danh sách'),
        'htmlOptions' => array('id' => 'breadcrumb')
    ));
    ?>
</div>
<div class="row-fluid">
    <div class="span12">
        <div class="widget-box">
            <div class="widget-content nopadding">
                <div id="DataTables_Table_0_wrapper" class="dataTables_wrapper" role="grid">
                    <?php if (Yii::app()->user->hasFlash('profileMessage')): ?>
                        <div class="success">
                            <?php echo Yii::app()->user->getFlash('profileMessage'); ?>
                        </div>
                    <?php endif; ?>
                    <?php 

// For all users
	$attributes = array(
			'username','email'
	);
	
	$profileFields=ProfileField::model()->forAll()->sort()->findAll();
	if ($profileFields) {
		foreach($profileFields as $field) {
			array_push($attributes,array(
					'label' => AdmincpModule::t($field->title),
					'name' => $field->varname,
					'value' => $model->profile->getAttribute($field->varname),
				));
		}
	}
	array_push($attributes,
		array(
			'name' => 'createtime',
			'value' => date("d.m.Y H:i:s",$model->createtime),
		),
		array(
			'name' => 'lastvisit',
			'value' => (($model->lastvisit)?date("d.m.Y H:i:s",$model->lastvisit):AdmincpModule::t('Not visited')),
		),
                array(
                    'name'=>'status',
                    'value' => $model->status==1?"Kích hoạt":"Chưa kích hoạt",
                )
	);
			
	$this->widget('bootstrap.widgets.TbDetailView', array(
		'data'=>$model,
		'attributes'=>$attributes,
	));

?>
                </div>
            </div>
        </div>
    </div>
</div>
